#ifndef _DEBUG_H
#define _DEBUG_H

#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#ifdef __WIN32__
#include <io.h>
#endif
#include <time.h>

#include "utf8.h"

#ifdef DEBUG
#define DBG(args ...) \
	print_error( __FILE__, (char*)__func__, __LINE__, ##args )
#else
#define DBG //
#endif
//

void print_error(char* file, char* function, int line, const char *fmt, ...);
void hex_dump( unsigned char * buf, int len );
void debug_term_on();
void debug_term_off();
void debug_file_on();
void debug_file_off();
void debug_set_dir(char* str);

void debug_setting_switch_by_str(char* arg);

char* hex_str(unsigned char *buf, int len, char* outstr );
char* hex_str2(unsigned char *buf, int len );
char* hex_char( char *buf, char* outstr );
char* hex_char2( char *buf );


void debug_hexpack_recv(int swh);
void debug_hexpack_send(int swh);

void debug_hex_pak_send(unsigned char* buf,char* title);
void debug_hex_pak_recv(unsigned char* buf,char* title);

static char* to_gb( char* s );

#endif //_DEBUG_H

